package com.gao.weblog.admin.weblog.web;

public abstract class AbstractPay {

    public abstract String payType();

    public static class PayRequest{

    }

    public static class PayResponse{

    }

    public void process(PayRequest request){
        beforeSaveRequest(request);
        saveRequest(request);
        PayResponse payResult = doPay(request);
        saveResponse(payResult);
        changeUserMoney(request,payResult);
    }

    protected void beforeSaveRequest(PayRequest request){

    }
    protected void afterPay(PayResponse response){
    }

    protected void changeUserMoney(PayRequest request, PayResponse payResult) {

    }

    protected void saveResponse(PayResponse payResult) {

    }

    protected abstract PayResponse doPay(PayRequest request);

    protected void saveRequest(PayRequest request) {

    }


}
